package com.system.provider;

import com.am.ui.grid.AbstractBaseGridProvider;
import com.system.uitls.SearchFilter;
import java.util.Map;

public class PrescriptionDrugProvider extends AbstractBaseGridProvider
{
  public String generateSql(Map<String, Object> map)
  {
    StringBuffer sf = new StringBuffer("SELECT  t4.name,t4.spec,t3.quantity,t2.id,t1.create_time FROM sys_diagnose t1,sys_patient_record t2,sys_prescription t3,sys_drug t4 WHERE t1.record_id = t2.id AND t2.person_id=:personId AND t2.status='7' AND t3.diagnose_id=t1.id AND t3.drug_id=t4.id");

    sf.append(SearchFilter.getSearchSql(map, null));

    sf.append(" ORDER BY create_time DESC");
    setParamMap(map);
    return sf.toString();
  }
}